package com.neasho.neashoadminv1.web.console.public

import com.neasho.neashoadminv1.infrastructure.domain.R
import com.neasho.neashoadminv1.infrastructure.dto.sys.SysUserLoginSpec
import com.neasho.neashoadminv1.infrastructure.dto.sys.SysUserLoginView
import com.neasho.neashoadminv1.web.service.sys.SysUserService
import jakarta.validation.Valid
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

/**
 * 公共 - 登录
 */
@RestController
@RequestMapping("/console")
class LoginController(
    val sysUserService: SysUserService
) {

    /**
     * 登录接口
     */
    @PostMapping("/login")
    fun login(@Valid @RequestBody input: SysUserLoginSpec): R<SysUserLoginView> {
        return R.ok(sysUserService.login(input))
    }

}